<?php
/**
 * @name          wx-qq-function    
 * @copyright     http://code.google.com/u/wxframework/
 * @version       $Id: debug.class.php 26 2009-04-15 01:19:51Z sean.fmais $
 * @author        $Author: sean.fmais $  <fmais@163.com>
 * 
**/
class Debug
{

		public $starttime = 0;
		public $pretime = 0;
		public $endtime = 0;
		public $node = array( );

		public function startTimer( )
		{
				$mtime = microtime( );
				$mtime = explode( " ", $mtime );
				$mtime = $mtime[1] + $mtime[0];
				$this->starttime = $mtime;
				$this->pretime = $mtime;
		}

		public function debugNode( $node_name )
		{
				$mtime = microtime( );
				$mtime = explode( " ", $mtime );
				$mtime = $mtime[1] + $mtime[0];
				$endtime = $mtime;
				$totaltime = round( $endtime - $this->pretime, 5 );
				$this->node[] = array(
						"name" => $node_name,
						"time" => $totaltime
				);
				$this->pretime = $endtime;
		}

		public function endTimer( )
		{
				$mtime = microtime( );
				$mtime = explode( " ", $mtime );
				$mtime = $mtime[1] + $mtime[0];
				$endtime = $mtime;
				$totaltime = round( $endtime - $this->starttime, 5 );
				$this->endtime = $endtime;
				return $totaltime;
		}

}
?>